home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / TinyGL / ami / content / ad709 / tinygl / src / api_texture.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-15  |  803 b   |  44 lines

  1. #include "texture.h"
  2.  
  3.  
  4. /* */
  5. void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures) {
  6.     GLContext    *c = gl_get_context();
  7.     int            max, i;
  8.     GLTexture    *t;
  9.  
  10.     max = 0;
  11.     for(i = 0; i < TEXTURE_HASH_TABLE_SIZE; i++) {
  12.         t = c->shared_state.texture_hash_table[i];
  13.         while(t != NULL) {
  14.             if(t->handle > max) {
  15.                 max = t->handle;
  16.             }
  17.  
  18.             t = t->next;
  19.         }
  20.     }
  21.  
  22.     for(i = 0; i < n; i++) {
  23.         textures[i] = max + i + 1;
  24.     }
  25. }
  26.  
  27. /* */
  28. void GLAPIENTRY glDeleteTextures(GLsizei n, const GLuint *textures) {
  29.     GLContext    *c = gl_get_context();
  30.     int            i;
  31.     GLTexture    *t;
  32.  
  33.     for(i = 0; i < n; i++) {
  34.         t = find_texture(c, textures[i]);
  35.         if(t != NULL && t != 0) {
  36.             if(t == c->current_texture) {
  37.                 glBindTexture(GL_TEXTURE_2D, 0);
  38.             }
  39.  
  40.             free_texture(c, textures[i]);
  41.         }
  42.     }
  43. }
  44.